<template>
  <div>
    <div class="dashboard-container">
      <div class="big-back-box">
        <el-container>

          <el-header style="margin-buttom: 30px">
            <h1>天天法务服务平台</h1>
          </el-header>
          <div style="height: 30px"></div>
        </el-container>
        <!-- 走马灯 -->
        <el-carousel :interval="4000" type="card" height="378px">
          <el-carousel-item v-for="item in merryGoRound" :key="item.id">
            <!-- <h3 class="medium" >{{ item.imgSrc }}</h3> -->
            <img :src="item.imgSrc" alt="走马灯图片加载失败" style="width: 576px; height: 378px" />
            <!--  -->
          </el-carousel-item>
        </el-carousel>
        <hr />
        <br />
        <!-- 优质服务 -->
        <div>
          <el-card class="box-card">
            <!-- 栏目名 -->
            <div slot="header" class="clearfix">
              <span>优质服务</span>
            </div>
            <!-- 内容小卡片 -->
            <el-row>
              <!-- 下面的:span=""决定了每个具体服务小卡片的大小 -->
              <el-col :span="4" v-for="o in 1" :key="o" :offset="0">
                <el-card :body-style="{ padding: '10px' }">
                  <img
                    src="https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-1.jpg"
                    class="image"
                  />
                  <div style="padding: 14px; text-align: center">
                    <span>知识产权</span>
                    <div class="bottom clearfix">
                      <router-link :to="{ path: '/IP/IPlist' }">
                        <el-button type="text" class="button">进入>></el-button>
                      </router-link>
                    </div>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4" v-for="o in 1" :key="o" :offset="1">
                <el-card :body-style="{ padding: '10px' }">
                  <img
                    src="https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-2.jpg"
                    class="image"
                  />
                  <div style="padding: 14px; text-align: center">
                    <span>合同定制</span>
                    <div class="bottom clearfix">
                      <router-link :to="{ path: '/legalDoc/custom' }">
                        <el-button type="text" class="button">进入>></el-button>
                      </router-link>
                    </div>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4" v-for="o in 1" :key="o" :offset="1">
                <el-card :body-style="{ padding: '10px' }">
                  <img
                    src="https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-3.jpg"
                    class="image"
                  />
                  <div style="padding: 14px; text-align: center">
                    <span>资质证照</span>
                    <div class="bottom clearfix">
                      <router-link :to="{ path: '/license/licenseList' }">
                        <el-button type="text" class="button">进入>></el-button>
                      </router-link>
                    </div>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4" v-for="o in 1" :key="o" :offset="1">
                <el-card :body-style="{ padding: '10px' }">
                  <img
                    src="https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-4.jpg"
                    class="image"
                  />
                  <div style="padding: 14px; text-align: center">
                    <span>公司设立</span>
                    <div class="bottom clearfix">
                      <router-link :to="{ path: '/compServer/setup' }">
                        <el-button type="text" class="button">进入>></el-button>
                      </router-link>
                    </div>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4" v-for="o in 1" :key="o" :offset="1">
                <el-card :body-style="{ padding: '10px' }">
                  <img
                    src="https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-5.jpg"
                    class="image"
                  />
                  <div style="padding: 14px; text-align: center">
                    <span>法律求助</span>
                    <div class="bottom clearfix">
                      <router-link :to="{ path: '/lawHelp/customerAsk' }">
                        <el-button type="text" class="button">进入>></el-button>
                      </router-link>
                    </div>
                  </div>
                </el-card>
              </el-col>
            </el-row>
          </el-card>
        </div>

        <br />
        <br />
        <br />

        <!-- 成功案例 -->
        <div>
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>成功案例</span>
              <router-link to="/successCase/articleList">
                <el-button style="float: right; padding: 3px 0" type="text">更多</el-button>
              </router-link>
            </div>
            <!-- 成功案例列表 -->
            <div style v-for="article in articleList" :key="article" class="text item">
              <el-span style="float: left; line-height: 3em">
                {{
                article.title
                }}
              </el-span>
              <el-span style="float: right">
                <router-link :to="{ path: '/successCase/readMore', query: article }">
                  <el-button type="text">详情</el-button>
                </router-link>
              </el-span>
            </div>
          </el-card>
        </div>

        <br />
        <br />
        <br />

        <!-- 优质机构 -->
        <div>
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>优质机构</span>
              <router-link to="/lawOffice/officeList">
                <el-button style="float: right; padding: 3px 0" type="text">更多</el-button>
              </router-link>
            </div>
            <!-- 内容小卡片 -->
            <el-row>
              <!-- 下面的:span="3"决定了每个具体服务小卡片的大小 -->
              <!-- offset决定与上一个小卡片的间距，故与每行多少个小卡片也有关 -->
              <!-- span="3"刚好能排5个一行 -->
              <el-col :span="4" v-for="office in officeList" :key="office" :offset="0">
                <el-card :body-style="{ padding: '10px' }" shadow="never">
                  <img :src="office.picture" alt="走马灯图片加载失败" style="width: 145px; height: 145px" />
                  <div style="padding: 14px; text-align: center">
                    <span>{{ office.enterpriseName }}</span>
                    <div class="bottom clearfix">
                      <time class="time">{{ office.officeLocation }}</time>
                      <router-link :to="{ path: '/lawOffice/readMore', query: office }">
                        <el-button type="text" class="button">详情</el-button>
                      </router-link>
                    </div>
                  </div>
                </el-card>
              </el-col>
            </el-row>
          </el-card>
        </div>

        <br />
        <br />
        <br />

        <!-- 服务评价 -->
        <div>
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>服务评价</span>
              <el-span style="float: right">
                <!-- <router-link
                  :to="{ path: '/lawHelp/customerReadMore', query: article }"
                >
                  <el-button style="float: right; padding: 3px 0" type="text">
                    更多
                  </el-button>
                </router-link>-->
              </el-span>
            </div>
            <!-- 服务评价列表 -->
            <div style v-for="assess in assessList" :key="assess" class="text item">
              <!-- show-text -->
              <!-- 将评级转换为星标 -->
              <div>
                <el-span style="float: left; line-height: 3em">
                  匿名用户
                  <el-rate
                    v-model="assess.evaluationGrade"
                    disabled
                    show-score
                    text-color="#ff9900"
                  ></el-rate>
                  {{ assess.evaluationContent }}
                </el-span>
              </div>
            </div>
          </el-card>
        </div>

        <br />
        <br />


      </div>

              <!-- 页脚 -->
        <div class="footer">
          <div class="footer-back-box">
            <!-- 友情链接 -->
            <div class="footer-title">
              <h4>友情链接</h4>
            </div>
            <hr />
            <div>
              <el-row :gutter="20">
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站1</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站2</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站3</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站4</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站5</el-link>
                </el-col>
                <div style="height: 30px"></div>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站6</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站7</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站8</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站9</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">法律网站10</el-link>
                </el-col>
              </el-row>
            </div>
            <!-- 合作网站 -->
            <div class="footer-title">
              <h4>合作网站</h4>
            </div>
            <hr />
            <div>
              <el-row :gutter="20">
                <el-col :span="6" class="footer-link-card">
                  <el-link href="http://www.12348.gov.cn/#/homepage" target="_blank">合作网站1</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站2</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站3</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站4</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站5</el-link>
                </el-col>
                <div style="height: 30px"></div>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站6</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站7</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站8</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站9</el-link>
                </el-col>
                <el-col :span="6" class="footer-link-card">
                  <el-link href="https://www.baidu.com" target="_blank">合作网站10</el-link>
                </el-col>
              </el-row>
            </div>
          </div>
        </div>
    </div>
  </div>
</template>

<script>
// 获取已上架成功案例列表
import { getPublishedArticleList } from "@/api/article.js";
// 获取优质的机构列表
import { getQualityServiceProvider } from "@/api/lawOffice.js";
// 获取已审核的服务评价
import { getSuccessOrderEvaluation } from "@/api/serviceAssess.js";

export default {
  data() {
    return {
      // 走马灯
      merryGoRound: [
        {
          id: 1,
          imgSrc:
            "https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-1.jpg"
        },
        {
          id: 2,
          imgSrc:
            "https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-2.jpg"
        },
        {
          id: 3,
          imgSrc:
            "https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-3.jpg"
        },
        {
          id: 4,
          imgSrc:
            "https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-4.jpg"
        },
        {
          id: 5,
          imgSrc:
            "https://law-photo.oss-cn-shenzhen.aliyuncs.com/lawService-dashboard/merryGoRound-5.jpg"
        }
      ],
      // 成功案例文章列表
      articleList: [],
      // 优质机构列表
      officeList: [],
      // 服务评价列表
      assessList: []
    };
  },
  // 初始化
  mounted() {
    // 获取5条上架的成功案例
    let articlePageData = {
      pageNum: 1,
      pageSize: 5
    };
    getPublishedArticleList(articlePageData).then(resp => {
      console.log("获取上架的成功案例 resp: " + resp);
      console.log(
        "resp.data.articleList.content: " + resp.data.articleList.content
      );
      this.articleList = resp.data.articleList.content;
      console.log("this.articleList[0].title: " + this.articleList[0].title);
    });
    // 获取5个优质的服务商（优质机构）
    let officePageNum = 1;
    let officePageSize = 6;
    console.log("优质机构let后");
    getQualityServiceProvider(officePageNum, officePageSize).then(resp => {
      console.log("获取5个优质服务商");
      console.log("resp: " + resp);
      console.log(
        "resp.data.qualityServiceProvider.content: " +
          resp.data.qualityServiceProvider.content
      );
      this.officeList = resp.data.qualityServiceProvider.content;
      console.log(
        "this.officeList[0].enterpriseName: " +
          this.officeList[0].enterpriseName
      );
    });
    // 获取5条已审核服务评价
    let assessPageNum = 1;
    let assessPageSize = 5;
    getSuccessOrderEvaluation(assessPageNum, assessPageSize).then(resp => {
      console.log("获取已审核服务评价 resp: " + resp);
      console.log(
        "resp.data.successOrderEvaluationPage.content: " +
          resp.data.successOrderEvaluationPage.content
      );
      this.assessList = resp.data.successOrderEvaluationPage.content;
      console.log("this.assessList[0].orderId: " + this.assessList[0].orderId);
    });
  },
  methods: {}
};
</script>

<style lang="scss" scoped>
// 页头LOGO
.top {
  height: 50px;
  width: 1080px;
  margin-left: 45px;
  // background-color: lightgray;
  font-size: 30px;
  text-align: center;
  line-height: 50px;
}

// 大盒子
.big-back-box {
  width: 1080px;
  margin: 0 auto;
}

// 卡片风格走马灯
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}
.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}

// 每一类服务的所属的那个背景卡片盒子（如：优质服务）
.text {
  font-size: 14px;
}
.item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}
.box-card {
  // width: 480px;
  margin-left: 15px;
  margin-right: 15px;
}

// 每一类服务下的小盒子（如：法律咨询）
.time {
  font-size: 13px;
  color: #999;
}
.bottom {
  margin-top: 13px;
  line-height: 12px;
}
.button {
  padding: 0;
  float: right;
}
.image {
  width: 100%;
  display: block;

  width: 145px;
  height: 145px;
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}

// 原框架自带
.dashboard {
  &-container {
    margin-top: 30px;
    // margin-left: 30px;
    // margin-right: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}

// 页脚
.footer {
  height: 250px;
  background-color: rgb(245, 245, 245);
  margin: 0 auto;
}
.footer-back-box {
  width: 1080px;
  margin: 0 auto;
}
.footer-title {
  height: 30px;
  line-height: 40px;
  padding-left: 10px;
}
.footer-link-card {
  width: 200px;
  // background-color: orange;
  margin-left: 10px;
}

// element-ui布局容器样式
.el-header,
.el-footer {
  // background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 10px;
}
.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}
body > .el-container {
  margin-bottom: 40px;
}
.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}
.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>
